package Homework3;

import java.util.Scanner;

public class Homework3_3 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[][] arr = new int[n][n];
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                arr[i][j] = input.nextInt();
        int count = Digits.digitCount(arr,n);
        System.out.println(count);
    }
}
